package com.weetop.akly.presenter;

import android.app.Activity;
import android.text.TextUtils;

import com.weetop.akly.base.mvp.BaseModel;
import com.weetop.akly.base.mvp.BaseObserver;
import com.weetop.akly.base.mvp.BasePresenter;
import com.weetop.akly.bean.SignInLogBean;
import com.weetop.akly.bean.MsgBean;
import com.weetop.akly.bean.SignRecordBean;
import com.weetop.akly.bean.WorkGroupBean;
import com.weetop.akly.view.SignListView;
import com.weetop.akly.view.SignRecordView;

import java.util.ArrayList;
import java.util.Map;

public class SignRecordPresent extends BasePresenter<SignRecordView> {
    public SignRecordPresent(SignRecordView baseView, Activity activity) {
        super(baseView, activity);
    }

    /**
     * 获取消息列表
     */
    public void geSignRecord_old(String page) {
        addDisposable(apiServer.getCheckinLog(page), new BaseObserver<BaseModel<ArrayList<SignInLogBean>>>(baseView) {
            @Override
            public void onSuccess(BaseModel<ArrayList<SignInLogBean>> o) {
                baseView.getSignRecordSuccess(o);
            }

            @Override
            public void onError(String msg) {
                if (baseView != null) {
                    baseView.showError(msg);
                }
            }
        });
    }


    /**
     * 获取消息列表 暂不用
     */
    public void geSignRecord(String page) {
        Map<String, String> params = myApplication.getGlobalData();
        // 模板种类：0打卡，1审批，2到期，3订单
        params.put("model_type", "0");
        params.put("page", page);
        addDisposable(apiServer.getSignRecoed(params), new BaseObserver<BaseModel<SignRecordBean>>(baseView) {
            @Override
            public void onSuccess(BaseModel<SignRecordBean> o) {
                baseView.getSignRecordSuccess_old(o);
            }

            @Override
            public void onError(String msg) {
                if (baseView != null) {
                    baseView.showError(msg);
                }
            }
        });
    }


    /**
     * 获取消息列表 暂不用
     */
    public void getCheckinLog(String page) {
        Map<String, String> params = myApplication.getGlobalData();
        params.put("page", page);
        addDisposable(apiServer.getCheckinLog(page), new BaseObserver<BaseModel<ArrayList<SignInLogBean>>>(baseView) {
            @Override
            public void onSuccess(BaseModel<ArrayList<SignInLogBean>> o) {
                baseView.getSignRecordSuccess_old1(o);
            }

            @Override
            public void onError(String msg) {
                if (baseView != null) {
                    baseView.showError(msg);
                }
            }
        });
    }

}
